import matplotlib.pyplot as plt


plt.rcParams['font.sans-serif'] = ['SimHei']  # 或 ['Microsoft YaHei']
plt.rcParams['axes.unicode_minus'] = False    # 正常显示负号
# 数据点
points = [
    (0, 0, 0),  # A: 标签0
    (1, 0, 1),  # B: 标签1
    (0, 1, 0),  # C: 标签0
    (1, 1, 1),  # D: 标签1
]

# 分别取出x, y, label
x0 = [x for x, y, label in points if label == 0]
y0 = [y for x, y, label in points if label == 0]
x1 = [x for x, y, label in points if label == 1]
y1 = [y for x, y, label in points if label == 1]

plt.figure(figsize=(5, 5))
plt.scatter(x0, y0, c='#f9a', label='标签0（非科技类）', s=100, edgecolors='k')
plt.scatter(x1, y1, c='#9f9', label='标签1（科技类）', s=100, edgecolors='k')

# 标注每个点
for x, y, label in points:
    plt.text(x, y+0.05, f'({x},{y})\n标签{label}', ha='center', fontsize=10)

plt.xlim(-0.2, 1.2)
plt.ylim(-0.2, 1.2)
plt.xlabel('特征1')
plt.ylabel('特征2')
plt.title('二维散点图：标签0/1分布')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()